home *** CD-ROM | disk | FTP | other *** search
/ The Atari Compendium / The Atari Compendium (Toad Computers) (1994).iso / files / prgtools / mint / mgr / sparcmgr / src.zoo / src / menu.h < prev    next >
Encoding:
C/C++ Source or Header  |  1989-03-17  |  3.1 KB  |  85 lines

  1. /*                        Copyright (c) 1987 Bellcore
  2.  *                            All Rights Reserved
  3.  *       Permission is granted to copy or use this program, EXCEPT that it
  4.  *       may not be sold for profit, the copyright notice must be reproduced
  5.  *       on copies, and credit should be given to Bellcore where it is due.
  6.  *       BELLCORE MAKES NO WARRANTY AND ACCEPTS NO LIABILITY FOR THIS PROGRAM.
  7.  */
  8. /*    $Header: menu.h,v 1.1 89/03/17 08:21:15 sau Exp $
  9.     $Source: /m1/mgr.new/src/RCS/menu.h,v $
  10. */
  11. static char    h_menu_[] = "$Source: /m1/mgr.new/src/RCS/menu.h,v $$Revision: 1.1 $";
  12.  
  13. /* header file for menu management routines */
  14. /* redo this one */
  15.  
  16. /* low level menu routine parameters */
  17.  
  18. #define MENU_BORDER        3    /* size of border around menu */
  19.  
  20. /* high level menu routine params */
  21.  
  22. #define EXIT_CHOICE    0    /* item was chosen */
  23. #define EXIT_BOTTOM    1    /* menu exited from bottom */
  24. #define EXIT_TOP    2    /* menu exited from top */
  25. #define EXIT_LEFT    4    /* menu exited from left */
  26. #define EXIT_RIGHT    8    /* menu exited from right */
  27.  
  28. #define MENU_FLAGS    1    /* change menu flags */
  29. #define MENU_AUTO    2    /* auto exit from menu to next */
  30. #define MENU_PAGE    4    /* auto page from menu to next */
  31. #define MENU_SNIP    8    /* only return leaf entries */
  32.  
  33. /* menu struct member access macros */
  34.  
  35. #define menu_exit(state)    (state)->exit
  36. #define menu_choice(state)    (state)->current
  37. #define menu_ischoice(state)    ((state)->current>=0 && \
  38.                  (state)->current<(state)->count)
  39. #define menu_ypos(state)    ((state)->menu_start.y + \
  40.                                  (state)->current * \
  41.                                  (state)->bar_size.y)
  42. #define menu_value(state)    (menu_ischoice(state)&&state->action? \
  43.                                  state->action[state->current].value: \
  44.                                  (char *) 0)
  45. #define menu_next(state)    ( menu_exit(state)==EXIT_BOTTOM && \
  46.                     (state)->next>=0 ? (state)->next : \
  47.                   (menu_ischoice(state)? \
  48.                                  (state)->action[(state)->current].next_menu:\
  49.                                   -1))
  50. #define menu_setnext(state,nxt)    ((state)->action[nxt].next_menu)
  51.  
  52. /* menu structures */
  53.  
  54. struct menu_action {
  55.    char *value;            /* string associated with item */
  56.    short next_menu;        /* next menu number off right */
  57.    };
  58.  
  59. struct menu_result {
  60.    char *value;            /* value string for this menu chioce */
  61.    struct menu_result *next;    /* next string */
  62.    };
  63.  
  64. struct menu_state {
  65.    BITMAP *menu;    /* where the menu image goes */
  66.    BITMAP *screen;    /* pointer to the display */
  67.    BITMAP *save;    /* stuff covered by menu */
  68.    short menu_startx,     /* menu starting coords on screen */
  69.          menu_starty;
  70.    short bar_sizex,     /* size of one menu item */
  71.          bar_sizey,
  72.          x_pos;        /* x position relative to inside */
  73.    struct menu_action *action;    /* value associated with each item */
  74.    short current;            /* currently selected bar */
  75.    short exit;            /* mouse position in menu */
  76.    short count;            /* number of entries */
  77.    short next;            /* index of next menu page */
  78.    short flags;            /* menu flags */
  79.    };
  80.  
  81. struct menu_state *menu_setup();
  82. struct menu_state *menu_define();
  83. struct menu_state *menu_remove();
  84. struct menu_state *menu_copy();
  85.